package com.ethink.system.converter;

import com.ethink.framework.common.converter.Converter;
import com.ethink.system.api.info.SystemFileInfo;
import com.ethink.system.common.entity.SystemFile;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

/**
 * 系统文件表 Converter转换器
 *
 * @author default
 * @date 2022-12-01
 */
@Component
public class SystemFileConverter implements Converter<SystemFileInfo, SystemFile> {

    @Override
    public SystemFile convertTo(SystemFileInfo info) {
        if(info == null) {
            return null;
        }
        SystemFile entity = new SystemFile ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SystemFileInfo convertFrom(SystemFile entity) {
        if(entity == null) {
            return null;
        }
        SystemFileInfo info = new SystemFileInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
